class ApiResponse {
    code = 200;
    message = "success";
    data = null;

    constructor(code = 200, message = "success", data = null) {
        this.code = code;
        this.message = message;
        this.data = data;
    }

    static ok(code = 200, message = "success", data = null) {
        return new ApiResponse(code, message, data)
    }

    static fail(code = 500, message = "fail") {
        return new ApiResponse(code, message, null)
    }

    sendData(data) {
        this.data = data;
        return this;
    }

    sendMessage(message) {
        this.message = message;
        return this;
    }
}

module.exports = {
    ApiResponse
}